package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchDailyStatisticsResults;
import com.ruoyi.system.service.IDispatchDailyStatisticsResultsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 每日统计结果Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchDailyStatisticsResults")
public class DispatchDailyStatisticsResultsController extends BaseController
{
    @Autowired
    private IDispatchDailyStatisticsResultsService dispatchDailyStatisticsResultsService;

    /**
     * 查询每日统计结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyStatisticsResults:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchDailyStatisticsResults dispatchDailyStatisticsResults)
    {
        startPage();
        List<DispatchDailyStatisticsResults> list = dispatchDailyStatisticsResultsService.selectDispatchDailyStatisticsResultsList(dispatchDailyStatisticsResults);
        return getDataTable(list);
    }

    /**
     * 导出每日统计结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyStatisticsResults:export')")
    @Log(title = "每日统计结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchDailyStatisticsResults dispatchDailyStatisticsResults)
    {
        List<DispatchDailyStatisticsResults> list = dispatchDailyStatisticsResultsService.selectDispatchDailyStatisticsResultsList(dispatchDailyStatisticsResults);
        ExcelUtil<DispatchDailyStatisticsResults> util = new ExcelUtil<DispatchDailyStatisticsResults>(DispatchDailyStatisticsResults.class);
        util.exportExcel(response, list, "每日统计结果数据");
    }

    /**
     * 获取每日统计结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyStatisticsResults:query')")
    @GetMapping(value = "/{dailyStatisticsResultsId}")
    public AjaxResult getInfo(@PathVariable("dailyStatisticsResultsId") Long dailyStatisticsResultsId)
    {
        return success(dispatchDailyStatisticsResultsService.selectDispatchDailyStatisticsResultsByDailyStatisticsResultsId(dailyStatisticsResultsId));
    }

    /**
     * 新增每日统计结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyStatisticsResults:add')")
    @Log(title = "每日统计结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchDailyStatisticsResults dispatchDailyStatisticsResults)
    {
        return toAjax(dispatchDailyStatisticsResultsService.insertDispatchDailyStatisticsResults(dispatchDailyStatisticsResults));
    }

    /**
     * 修改每日统计结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyStatisticsResults:edit')")
    @Log(title = "每日统计结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchDailyStatisticsResults dispatchDailyStatisticsResults)
    {
        return toAjax(dispatchDailyStatisticsResultsService.updateDispatchDailyStatisticsResults(dispatchDailyStatisticsResults));
    }

    /**
     * 删除每日统计结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyStatisticsResults:remove')")
    @Log(title = "每日统计结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dailyStatisticsResultsIds}")
    public AjaxResult remove(@PathVariable Long[] dailyStatisticsResultsIds)
    {
        return toAjax(dispatchDailyStatisticsResultsService.deleteDispatchDailyStatisticsResultsByDailyStatisticsResultsIds(dailyStatisticsResultsIds));
    }
}
